package com.sinvo.oa.custom;

import com.sinvo.oa.util.MD5;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.stereotype.Component;

/**
 * @Description 自定义密码加密类
 */
@Component
public class CustomMd5PasswordEncoder implements PasswordEncoder {
    @Override
    public String encode(CharSequence rawPwd) {
        return MD5.encrypt(rawPwd.toString());
    }

    @Override
    public boolean matches(CharSequence rawPwd, String encryptedPwd) {
        return encryptedPwd.equals(encode(rawPwd));
    }

}
